package chixing.day02;

import java.nio.charset.StandardCharsets;

public class BasicSyntaxDemo {
        public static void main(String[] args) {
            //1.变量variable
            String stuName="tom";
            //2.常量constant：值不能改变,final修饰，字母全大写，多个字母用下划线分隔
            final String SALE_PLATFORM="京东";

            long userTelno=18317249020L;
            long l1=32;  //32是int类型，战4字节，赋值给long
            long l2=32L;//32是long类型，站8字节

            //强制转换
            int i3=130;
            byte i4=(byte)i3;   //超出范围后在-127~128中循环
            System.out.println(i4);

            char c1='a';
            char c2='你';//默认是可以接受一个中文汉字

            String str="你";
            byte[] bytes=str.getBytes();
            System.out.println("str编码下所占字节数"+bytes.length);

            byte[] bytes2=str.getBytes(StandardCharsets.UTF_8);
            System.out.println("str编码下所占字节数"+bytes2.length);

            byte[] bytes3=str.getBytes(StandardCharsets.ISO_8859_1);
            System.out.println("str编码下所占字节数"+bytes3.length);

            char c3='e';
            int c4='a';
            int c5='A';
            System.out.println(c4);
            System.out.println(c5);

            for(char i='A';i<='Z';i++){
                System.out.print(i+" ");
            }
            System.out.println();

            String str1="Reads a single character";
            System.out.println("对应的数组转换为char[]--------");
            char[] charArray=str1.toCharArray();
            for (int i=0;i<charArray.length;i++){
                System.out.print(charArray[i]+",");
            }
            System.out.println();
            System.out.println("对应的数组转换为byte[]---------");
            byte[] byteArray=str1.getBytes();
            for (int i=0;i<byteArray.length;i++){
                System.out.print(byteArray[i]+",");
            }
            System.out.println();

            //布尔类型
            int x1=90;
            int x2=90;
            boolean x3=x1==x2;
            System.out.println(x3);
            if (x1>11){
                System.out.println("x>11");
            }else {
                System.out.println("x<=11");
            }

            if (x3){
                System.out.println("x1==x2");
            }else {
                System.out.println("x1!=x2");
            }




        }
}
